/*
 * @Author: huang yuanfa
 * @Date: 2022-10-15 09:33:09
 * @LastEditTime: 2022-11-17 09:04:38
 * @LastEditors: huang yuanfa
 * Copyright 2022 huang yuanfa All Rights Reserved.
 * @Gitee: https://gitee.com/huangyuanfa
 * @Github: https://github.com/hyf888
 * @FilePath: /src/Basic/HFuncType.h
 * @Description: file content
 */

#ifndef __THREADPOOL_BASIC_HFUNCTYPE_H__
#define __THREADPOOL_BASIC_HFUNCTYPE_H__

#include <functional>
#include "HTypedef.h"

HTHREADPOOL_NAMESPACE_BEGIN

    using THREADPOOL_DEFAULT_FUNCTION           = std::function<void()>;
    using THREADPOOL_DEFAULT_CONST_FUNCTION_REF = const std::function<void()>&;

/** 开启函数流程 */
#define THREADPOOL_FUNCTION_BEGIN HStatus status;

/** 结束函数流程 */
#define THREADPOOL_FUNCTION_END return status;

/** 无任何功能函数 */
#define THREADPOOL_EMPTY_FUNCTION return HStatus();

/** 不支持当前功能 */
#define THREADPOOL_NO_SUPPORT return HStatus(HTHREADPOOL_FUNCTION_NO_SUPPORT);

/** 返回异常信息和状态 */
#define THREADPOOL_RETURN_ERROR_STATUS(info) return HStatus(info);

/** 定义为不能赋值和拷贝的对象类型 */
#define THREADPOOL_NO_ALLOWED_COPY(HType)                                                                              \
    HType(const HType&) = delete;                                                                                      \
    HType& operator=(const HType&) = delete;

/** 抛出异常 */
#define THREADPOOL_THROW_EXCEPTION(info) throw HException(info);

HTHREADPOOL_NAMESPACE_END

#endif
